#include "widget.h"
#include "ui_widget.h"
#include <QMessageBox>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    srand(time(0));
    ui->label->setText("你喜欢学习吗？");

    connect(ui->pushButton_no,&PushButton::dialog,this,&Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    //创建一个消息框
    QMessageBox::information(this,"开摆","学习，学个屁");
    //关闭主窗口
    this->close();
}

void Widget::on_pushButton_yes_clicked()
{
    ui->label->setText("学习使我快乐！！！");
}
